var app = getApp();
function req(url, data, method, success, fail){
    var mydata = data || {};
    console.log(mydata)
    var contentType ='application/json' ; 

    if (method === 'POST' || method === 'post'){
      contentType = 'application/x-www-form-urlencoded';
    }

    wx.request({
      url: app.globalData.COMMON_URL + url,
      data: mydata,
      method: method,
      header: {
        'content-type': contentType
      },
      success: success,
      fail: fail,
      complete: function() {
        // complete
      }
    })
}
module.exports = {
  req: req
}